package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.StudentGrades;
import com.ruoyi.system.mapper.StudentGradesMapper;
import com.ruoyi.system.service.IStudentGradesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentGradesServiceImpl implements IStudentGradesService {
    @Autowired
    StudentGradesMapper studentGradesMapper;

    @Override
    public List<StudentGrades> getStudentGrades(StudentGrades studentGrades) {
        List<StudentGrades> studentGrades1 = studentGradesMapper.selectAll(studentGrades);
        return studentGrades1;

    }

    @Override
    public String addStudentGrades(StudentGrades studentGrades) {
        int insert = studentGradesMapper.insert(studentGrades);
        if (insert==1){
            return "添加成功";
        }else {
            return "添加失败";
        }

    }

    @Override
    public String updateStudentGrades(StudentGrades studentGrades) {
        int update = studentGradesMapper.update(studentGrades);
        if (update==1){
            return "修改成功";
        }
        else {
            return "修改失败";
        }

    }

    @Override
    public String deleteStudentGrades(StudentGrades studentGrades) {
        int delete = studentGradesMapper.delete(studentGrades);
        if (delete==1){
            return "删除成功";
        }
        else {
            return "删除失败";
        }
    }
}
